﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class UIMain : MonoBehaviour
{
    public LvController lvCtrl;
    public Text level;
    public Slider slider, slider2;
    public Text itemBili, sliderBili;
    public Text text, lastTime;
    public GameObject UIReward, UILose;
    // Use this for initialization
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {

    }

    public void SetTarget()
    {
        slider.maxValue = LvController.Instance.itemNeed;
        slider.value = 0;
        slider2.maxValue = LvController.Instance.itemNeed;
        slider2.value = 0;
        level.text = "LV0" + LvController.Instance.currentLv.ToString();
        itemBili.text = LvController.Instance.currentItem.ToString() + "/" +  LvController.Instance.itemNeed.ToString();
        sliderBili.text = LvController.Instance.currentItem.ToString() + "/" + LvController.Instance.itemNeed.ToString();
        //text.text = LvController.Instance.second.ToString() + "秒内完美打包" + LvController.Instance.itemNeed.ToString() +
        //    "件物品可通关\n" + LvController.Instance.threeSecond.ToString() + "秒内完成可获得3星奖励";
        text.text = "剩余" + LvController.Instance.chance.ToString() + "次机会";
    }

    public void OpenFailed()
    {
        UILose.SetActive(true);
    }

    public void OpenVictory()
    {
        UIReward.SetActive(true);
        UIReward.GetComponent<UIReward>().Init();
    }
}